var url = require('url');
var template = require('templateConfig');
var main = require('main'); 
var module= require('module');

//模板配置
var tplArr = [];
var couponTpl =require('raw!../template/coupon.txt'); 
tplArr['coupon'] = template.compile(couponTpl.replace(/^\s*|\s*$/g, "")); 
 
function Index(){
    _this = this;
    this.main = function(){
        main.event(this,'tap','i-click'); 
        this.init();
    }     

    this.getContent= function(){
    	var dataCheck= {
    		tType: "checklist",
    		name: "addr[]",
    		dataList: [{
    			content: "满130减20", 
    			value: 1, 
    			kvlist: [{
    				key: "有效期",
    				value: "2016-08-08"
    			},{
    				key: "适用范围",
    				value: "大家乐微店"
    			}]

    		},{
    			content: "满130减30", 
    			value: 2, 
    			kvlist: [{
    				key: "有效期",
    				value: "2016-08-08"
    			},{
    				key: "适用范围",
    				value: "大家乐微店"
    			}]
    		}],  		
    	};
    	var data= {
    		tType: "content",
    		coupon: module.getModule(dataCheck, "checklist"), 
    		btnName: "选择",
    		link: "javascript:;",  
    	} 
    	$(".content").html(tplArr['coupon'](data)) 
    }
    
    this.getFooter= function () {        
    	var data= { 
    		number: "12345", 
    		dataList: [{
    			link: "",
    			icon: "",
    			name: "首页"
    		},{
    			link: "",
    			icon: "",
    			name: "购物车"
    		},{
    			link: "",
    			icon: "",
    			name: "个人中心"
    		}] 
    	} 
    	$(".wrap").append(module.getModule(data, "footer")) 
    }

    this.init= function(){  
        this.getContent();   
        this.getFooter();           
    }
    return this.main();
};

var index = new Index();